package com.tjsoft.demo.webChat.action;

import java.util.Map;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;

import org.apache.struts2.ServletActionContext;
import org.apache.struts2.interceptor.ServletRequestAware;
import org.apache.struts2.interceptor.ServletResponseAware;
import org.apache.struts2.interceptor.SessionAware;

import com.opensymphony.xwork2.ActionContext;
import com.opensymphony.xwork2.ActionSupport;

public class BaseAction extends ActionSupport implements SessionAware,
	ServletRequestAware, ServletResponseAware {

	public HttpServletRequest request;
	public HttpServletResponse response;
	public Map session;
	// 校验提示信息
	private String validMessage;
	
	public BaseAction(){ 
		request = ServletActionContext.getRequest();
		response = ServletActionContext.getResponse();
		session = ActionContext.getContext().getSession();
	}

	public HttpServletRequest getRequest() {
		return request;
	}

	public HttpServletResponse getResponse() {
		return response;
	}

	public Map getSession() {
		return session;
	}
	
	public HttpSession getHttpSession() {
		return request.getSession();
	}

	@Override
	public void setServletRequest(HttpServletRequest request) {
		this.request = request;
	}

	@Override
	public void setServletResponse(HttpServletResponse response) {
		this.response = response;
	}

	@Override
	public void setSession(Map session) {
		this.session = session;
	}

	public String getValidMessage() {
		return validMessage;
	}

	public void setValidMessage(String validMessage) {
		this.validMessage = validMessage;
	}
	
	
}
